package com.polaris.live.common.mvvm.activity

import android.view.View
import androidx.viewbinding.ViewBinding
import com.polaris.live.common.mvvm.ext.inflateBindingWithGeneric
import com.polaris.live.common.mvvm.viewmodel.BaseViewModel

/**
 * viewBinding的封装
 *
 * @author Created by 半仙 on 2023/7/31/031 15:18
 */
abstract class BaseVmVbActivity<VM : BaseViewModel, VB : ViewBinding> : BaseVmActivity<VM>() {

    override fun layoutId(): Int = 0

    private lateinit var _binding: VB
    val mBinding: VB get() = _binding

    /**
     * 创建viewBinding
     */
    override fun initDataBind(): View? {
        _binding = inflateBindingWithGeneric(layoutInflater)
        return _binding.root
    }
}